<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
    <style type="text/css">
        *{
        	margin: 0;
        	padding: 0;
        	list-style: none;
        }
    	#div1{
    		position: absolute;
    		width:120px;
    		background: #ccc;
    		border: 1px solid #000;
    		height: auto;
    		overflow: hidden;
    		display: none;
    	}
    </style>

	<script type="text/javascript">
		document.oncontextmenu=function(ev){
			var oEvent=ev||event;
			var oDiv=document.getElementById('div1');

			oDiv.style.display='block';
			oDiv.style.left=oEvent.clientX+'px';
			oDiv.style.top=oEvent.clientY+'px';

			//oncontextmenu 有返回值
			return false;  //阻止默认菜单
			//阻止了以后，加一个自己的菜单
		};

        document.onclick=function(){
        	var oDiv=document.getElementById('div1');
        	oDiv.style.display='none';
        }

	</script>
</head>
<body>
	<div id="div1">
		<ul>
			<li>5435</li>
			<li>5435</li>
			<li>gdfg</li>
			<li>gd</li>
			<li>56765</li>
		</ul>
	</div>
</body>
</html>